home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / xulrunner / python / maps.py < prev    next >
Encoding:
Python Source  |  2007-11-12  |  1.8 KB  |  42 lines

  1. # Miro - an RSS based video player application
  2. # Copyright (C) 2005-2007 Participatory Culture Foundation
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  17.  
  18. import tabs
  19. import feed
  20. import folder
  21. import playlist
  22. import guide
  23.  
  24. # Given an object for which mappableToTab returns true, return a Tab
  25. def mapToTab(obj):
  26.     if isinstance(obj, guide.ChannelGuide):
  27.         # Guides come first and default guide comes before the others.  The rest are currently sorted by URL.
  28.         return tabs.Tab('guidetab', 'guide-loading', 'default', obj)
  29.     elif isinstance(obj, tabs.StaticTab):
  30.         return tabs.Tab(obj.tabTemplateBase, obj.contentsTemplate, obj.templateState, obj)
  31.     elif isinstance(obj, feed.Feed):
  32.         return tabs.Tab('feedtab', 'channel',  'default', obj)
  33.     elif isinstance(obj, folder.ChannelFolder):
  34.         return tabs.Tab('channelfoldertab', 'channel-folder', 'default', obj)
  35.     elif isinstance(obj, folder.PlaylistFolder):
  36.         return tabs.Tab('playlistfoldertab','playlist-folder', 'default', obj)
  37.     elif isinstance(obj, playlist.SavedPlaylist):
  38.         return tabs.Tab('playlisttab','playlist', 'default', obj)
  39.     else:
  40.         raise StandardError
  41.     
  42.